﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Odyssey.Utils;
using System.Linq;

namespace Odyssey.Controls.Primitives
{
    public class LongQuickJumpList : AlphabeticalQuickJumpList
    {
        public LongQuickJumpList(FrameworkElement nestedElement)
            : base(nestedElement)
        {
            DefaultStyleKey = typeof(LongQuickJumpList);
            Loaded += OnLoaded;
        }

        protected override void OnClosed()
        {
            //ScrollViewer sv = this.GetVisualDescendants().OfType<ScrollViewer>().FirstOrDefault();
            //if (sv != null) sv.ScrollToVerticalOffset(0d);
            base.OnClosed();
        }

        void OnLoaded(object sender, RoutedEventArgs e)
        {
            ScrollViewer sv = this.GetVisualDescendants().OfType<ScrollViewer>().FirstOrDefault();
            if (sv != null) sv.ScrollToVerticalOffset(0d);
        }

       
    }
}